#!/usr/bin/perl

use strict;
use Data::Dumper;
use Switch;

my $cmd = \@ARGV;
my $cmdStr = "State_Current_State  :  1";
#print $0. " " . join(" ", $cmd);
my $dStr = "1474099090: UFS: 6:       9438   DenseFile1";
my $dStr =~ /UFS.*(\d+)\s*(\S+)/;
#print $1, "--", $2, "\n";

my %recovertool = ();
my $i = 1;
while($i < 10) {
        $cmdStr = "State_Current_State  :  " . $i;
        if($cmdStr =~ /State_Current_State\s+:\s+(.+)$/)
        {
          $recovertool{State_Current_State} = $1;
          switch(hex($1))
          {
            case 0
            {
              $recovertool{State_comment} = "Invalid";
              last;
            }
            case 1
            {
              $recovertool{State_comment} = "Initializing";
              last;
            }
            case 2
            {
              $recovertool{State_comment} = "Ready";
              last;
            }
            case 3
            {
              $recovertool{State_comment} = "Faulted";
              last;
            }
            case 4
            {
              $recovertool{State_comment} = "Offline";
              last;
            }
            case 5
            {
              $recovertool{State_comment} = "Destroying";
              last;
            }
            case 6
            {
              $recovertool{State_comment} = "Expunging";
              last;
            }
            default
            {
              $recovertool{State_comment} = "Undefined Status";
              last;
            }
        }
    }
    $i++;
    sleep(3);
print "\n" . $recovertool{State_comment} . "\n";
}
